﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace WpfImageDuplicates
{
    /// <summary>
    /// Interaction logic for FullImageView.xaml
    /// </summary>
    public partial class DirectoryView : UserControl
    {
        public static readonly DependencyProperty DirectoryToExamineViewModelProperty =
            DependencyProperty.Register("DirectoryToExamineViewModel", typeof(DirectoryToExamineViewModel), typeof(DirectoryView), new PropertyMetadata(null, OnDirectoryToExamineViewModelPropertyChanged));

        public DirectoryToExamineViewModel DirectoryToExamineViewModel
        {
            get { return (DirectoryToExamineViewModel)GetValue(DirectoryToExamineViewModelProperty); }
            set { SetValue(DirectoryToExamineViewModelProperty, value); }
        }

        private static void OnDirectoryToExamineViewModelPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DirectoryView source = d as DirectoryView;
            DirectoryToExamineViewModel v = e.NewValue as DirectoryToExamineViewModel;
            source.UpdateDirectoryToExamineViewModel(v);
        }

        private void UpdateDirectoryToExamineViewModel(DirectoryToExamineViewModel viewModel)
        {
            DirectoryToExamineViewModel = viewModel;
            this.DataContext = DirectoryToExamineViewModel;
        }

        public DirectoryView()
        {
            InitializeComponent();
        }

        private void lstItems_KeyDown(object sender, KeyEventArgs e)
        {

        }
    }
}
